package day1.TraversalBinaryTree;

import org.w3c.dom.Node;

import java.util.List;

/**
 * @author pacai
 * @version 1.0
 */
public class SameTree {
    private static class BinTree {
        int val;
        BinTree left;
        BinTree right;
    }

    public static boolean isSameTree(BinTree tree1, BinTree tree2) {
        if (tree1 == null ^ tree2 == null) return false;
        if (tree1 == null & tree2 == null) return true;
        return tree1.val == tree2.val && isSameTree(tree1.left, tree2.left)
                && isSameTree(tree1.right, tree2.right);
    }

}
